package cn.edu.jxyy.mybatistest.test;



import cn.edu.jxyy.mybatistest.Utils.MyBatisUtils;
import cn.edu.jxyy.mybatistest.mapper.StudentMapper;
import cn.edu.jxyy.mybatistest.mapper.UserMapper;
import cn.edu.jxyy.mybatistest.pojo.Student;
import cn.edu.jxyy.mybatistest.pojo.User;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class Alltest1 {
    public static void main(String[] args){
        SqlSession sqlSession = MyBatisUtils.getSession();

        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
        List<User> listUser = userMapper.findAllUser();
        for (User user : listUser) {
            System.out.println(user);
        }

        StudentMapper studentMapper =
                sqlSession.getMapper(StudentMapper.class);

        List<Student> listStudent = studentMapper.findAllStudent();
        for (Student student : listStudent) {
            System.out.println(student);
        }
        sqlSession.close();
    }
}
